#include "stdafx.h"
#include <Strsafe.h>
#include "TempFile.h"

#include "Exec.h"

TempFile::TempFile(void){
	TCHAR path[MAX_PATH];
	name[0]=0;
	if(!GetTempPath(MAX_PATH,path))
		return;
	GetTempFileName(path,_T("fx~"),0,name);
}
TempFile::~TempFile(){
	DeleteFile(name);
}

void TempFile::exec(PTSTR cmdLine){
	Exec::exec(name,cmdLine);
}
void TempFile::write(Bin* bin){
	create(name,GENERIC_READ|GENERIC_WRITE,CREATE_ALWAYS);
	File::write(bin);
}